<%@ page import="java.sql.Date" %>
<%@ page import="java.sql.Time" %>
<%@ include file="../abrirEvento.jsp" %>

<%
    ListaRosena lstBlog = (ListaRosena) objEvento.getLista("blog");
    request.getSession().setAttribute("active","blog");

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title><%=tituloPagina%></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="css/coin-slider.css"/>
    <script type="text/javascript" src="js/cufon-yui.js"></script>
    <script type="text/javascript" src="js/cufon-georgia.js"></script>
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="js/script.js"></script>
    <script type="text/javascript" src="js/coin-slider.min.js"></script>
</head>
<body>
<div class="main">
<%@ include file="cabecalho.jsp" %>
<div class="content">
<div class="content_resize">
    <div height="10%" width="10%">
<%for (int i = 0; i < lstBlog.size(); i++) {
    Persistente objBlog = (Persistente) lstBlog.get(i);
    ListaRosena lstComentarioBlog = objBlog.getLista("comentarios"," ID ASC ");
    String titulo = objBlog.getString("titulo");
    String texto = objBlog.getString("descricao");
    Date dataPublicacao = objBlog.getDate("dataPublicacao");
    String mesPublicacao = br.com.rosena.util.Util.mesAno(dataPublicacao);
    String diaPublicacao = br.com.rosena.util.Util.formatarData(dataPublicacao,"dd");
    String anoPublicacao = br.com.rosena.util.Util.formatarData(dataPublicacao,"yyyy");%>
    <div class="mainbar">
        <div class="article">
            <h2><span><%=titulo%></h2>

            <div class="clr"></div>
            <p>Postado por <a href="#">Admin</a> <span>&nbsp;&bull;&nbsp;</span>

            <p align="justify">
                <%=texto.replace("@quebraLinha@","<br>")%>
            </p>
            <p><a href="#"><strong>Comments (<%=lstComentarioBlog.size()%>)</strong></a> <span>&nbsp;&bull;&nbsp;</span> <%=mesPublicacao%> <%=diaPublicacao%>, <%=anoPublicacao%> <span>&nbsp;&bull;&nbsp;</span>
        </div>
        <div class="article">
            <h2><span><%=lstComentarioBlog.size()%></span> responsta(s)</h2>
            <%for (int j = 0; j < lstComentarioBlog.size(); j++) {
                Persistente objComentarioBlog = (Persistente) lstComentarioBlog.get(j);
                Persistente objPessoaSite = new Persistente("PessoaSite",objComentarioBlog.getPersistente("pessoaSite").getId() );
                String comentario = objComentarioBlog.getString("comentario");
                Date dataPublicacaoComentario = objComentarioBlog.getDate("dataPublicacao");
                Time horaPublicacaocomentario = objComentarioBlog.getTime("horaPublicacao");
                String nome = objPessoaSite.getString("nome");

                String mes = br.com.rosena.util.Util.mesAno(dataPublicacaoComentario);
                String dia = br.com.rosena.util.Util.formatarData(dataPublicacaoComentario,"dd");
                String ano = br.com.rosena.util.Util.formatarData(dataPublicacaoComentario,"yyyy");
                String hora = br.com.rosena.util.Util.formatarData(horaPublicacaocomentario,"HH:mm");

            %>
                <div class="clr"></div>
                <div class="comment"><a href="#"><img src="images/userpic.gif" width="40" height="40" alt=""class="userpic"/></a>
                    <p><a href="#"><%=nome%></a> diz:<br/>
                        <%=mes%> <%=dia%>, <%=ano%> as <%=hora%></p>
                    <p><%=comentario.replace("@quebraLinha@","<br>")%></p>
                </div>
            <%}%>
        </div>
        <%if(USUARIO_LOGADO_SITE != null){%>
            <div class="article">
                <h2><span>Deixe uma</span> Resposta</h2>
                <div class="clr"></div>
                <form action="gravarMensagemBlog.jsp?idBlog=<%=objBlog.getId()%>" method="post" id="leavereply">
                    <ol>
                        <li>
                            <label for="message">Sua Mensagem</label>
                            <textarea id="message" name="message" rows="8" cols="50"></textarea>
                        </li>
                        <li>
                            <input type="image" name="imageField" id="imageField" src="images/submit.gif" class="send"/>
                            <div class="clr"></div>
                        </li>
                    </ol>
                </form>
            </div>
        <%}%>
    </div>
<%}%>
    </div>
<div class="sidebar" style="left:900px;position:absolute;">
    <%@ include file="menu.jsp" %>
    <%@ include file="apoio.jsp" %>
</div>
<div class="clr"></div>
</div>
</div>
<%@ include file="rodape.jsp" %>
<%@ include file="copyright.jsp" %>
</div>
</body>
</html>
